package mysql

import "gorm.io/gorm"

type Doctor struct {
	gorm.Model
	DoctorCode string `gorm:"type:varchar(30);not null;comment:'工号'"`
	Password   string `gorm:"type:varchar(32);not null;comment:'密码'"`
	DoctorName string `gorm:"type:varchar(32);not null;comment:'姓名'"`
	DoctorRoom string `gorm:"type:varchar(32);not null;comment:'科室'"`
}

func (d *Doctor) FindDoctor(db *gorm.DB, code string) error {
	return db.Debug().Where("doctor_code = ?", code).First(d).Error
}

func (d *Doctor) FindDoctorById(db *gorm.DB, id int64) error {
	return db.Debug().Where("id = ?", id).First(d).Error
}
